import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  base:'./',
  plugins: [vue()],
  server: {
    host: '0.0.0.0',//解决控制台：Network : use --host to expose报错
    port: 8080,//配置端口号
    hmr: true,//开启热更新
    open: true,
    proxy: {
      '/api': { //所有/api的请求都会转化到下面的后端接口
        target: 'http://118.126.105.145:8089',
        changeOrigin: true, //是否跨域
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  },
  resolve: {
    alias: [
      {
      find: '@',
      replacement: resolve(__dirname, 'src')
      }
    ]
  },
  build: {
    chunkSizeWarningLimit: 1500,
  },
  define: {
    'process.env': {
      //'BASE_API': "http://192.168.31.208:8089"
      'BASE_API':"http://118.126.105.145:8089"
    }
  }, 
})
